﻿using NewChillers.Models;
using NewChillers.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace NewChillers.Views
{
    /// <summary>
    /// ProductPage.xaml 的交互逻辑
    /// </summary>
    public partial class ProductPage : UserControl
    {
        public ProductPage(UserModel userModel, ShellViewModel shellViewModel)
        {
            var viewmodel = new ProductViewModel(userModel, shellViewModel);
            this.DataContext = viewmodel;

            InitializeComponent();
        }

        /// <summary>
        /// 在代码中处理列宽调整
        /// </summary>
        //private void DataGrid_Loaded(object sender, RoutedEventArgs e)
        //{
        //    var dataGrid = sender as DataGrid;
        //    if (dataGrid != null)
        //    {
        //        foreach (var column in dataGrid.Columns)
        //        {
        //            var header = column.Header as DataGridColumnHeader;
        //            if (header != null)
        //            {
        //                header.MouseMove += (s, args) =>
        //                {
        //                    if (args.LeftButton == MouseButtonState.Pressed)
        //                    {
        //                        // 处理列宽调整逻辑
        //                        var pos = args.GetPosition(header);
        //                        if (pos.X > header.ActualWidth - 5)
        //                        {
        //                            // 进入调整宽度模式
        //                            Mouse.OverrideCursor = Cursors.SizeWE;
        //                        }
        //                        else
        //                        {
        //                            Mouse.OverrideCursor = null;
        //                        }
        //                    }
        //                };
        //            }
        //        }
        //    }
        //}

    }
}
